<!--
 * @Author: HeAo
 * @Date: 2021-10-15 09:58:13
 * @LastEditTime: 2021-10-15 10:17:30
 * @LastEditors: HeAo
 * @Description: 
 * @FilePath: \web2103-2105\web2105\3-2-Vue\day07\3-axios使用.html
 * 别乱动！
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>axios基础使用</title>
  <script src="../js/axios.js"></script>
  <script src="../js/qs.js"></script>
  <script>
    let qs = Qs
    const baseUrl = 'http://47.94.46.113:8888'
    const loginData = {
      username: 'admin1',
      password: 123321
    }
    const applyData = {
      name: 'larry',
      gender: 'female',
      telephone: '13455667788'
    }

    axios({
      url: baseUrl + '/user/login',
      method: 'post',
      data: loginData
    })

    axios({
      url: baseUrl + '/index/apply/saveOrUpdate',
      method: 'post',
      headers: {
        'Content-Type': 'application/x-www-from-urlencoded;charset=utf-8'
      },
      data: qs.stringify(applyData)
    })

    axios({
      url: baseUrl + '/index/article/pageQuery',
      method: 'get',
      params: {
        page: 1,
        pageSize: 10
      }
    }).then((res) => {
      console.log(res.data.data.list);
    }).catch((error) => {
      console.log(error);
    })
  </script>
</head>

<body>

</body>

</html>